Design and Specification of Iterators Using the Swapping Paradigm
نویسندگان
چکیده
How should iterators be abstracted and encapsulated in modern imperative languages, e.g., Ada and C++? We consider the combined impact of several factors on this question: the need for a “common interface model” for userdefined iterator abstractions; the importance of formal methods in specifying such a model; and problems involved in modular correctness proofs of iterator implementations and clients. A series of iterator designs illustrates the advantages of the “swapping paradigm” over designs based on the traditional “copying paradigm.” Specifically, swapping-based designs admit more efficient implementations, while offering straightforward formal specifications and the potential for modular reasoning about program behavior. The final proposed design schema defines a common interface model for iterators for a wide variety of generic collection abstractions in languages such as Ada and C++. Index Terms — Formal specification, iterator, program verification, proof of correctness, swapping. Copyright © 1992 by the authors. All rights reserved. 1 Department of Computer and Information Science, The Ohio State University, 2036 Neil Ave. Mall, Columbus, OH 43210. Telephone: 614-292-1517. Internet: [email protected], [email protected]. 2 Department of Mathematics and Computer Science, Muskingum College, New Concord, OH 43762. Internet: [email protected]. 3 Department of Computing and Information Science, Queen’s University, Kingston, Ontario K7L 3N6, Canada. Internet: [email protected].
منابع مشابه
Bit Swapping Linear Feedback Shift Register For Low Power Application Using 130nm Complementary Metal Oxide Semiconductor Technology (TECHNICAL NOTE)
Bit swapping linear feedback shift register (BS-LFSR) is employed in a conventional linear feedback shirt register (LFSR) to reduce its power dissipation and enhance its performance. In this paper, an enhanced BS-LFSR for low power application is proposed. To achieve low power dissipation, the proposed BS-LFSR introduced the stacking technique to reduce leakage current. In addition, three diffe...
متن کاملA Modular Way to Reason About Iteration
In this paper we present an approach to specify programs performing iterations. The idea is to specify iteration in terms of the finite sequence of the elements enumerated so far, and only those. In particular, we are able to deal with non-deterministic and possibly infinite iteration. We show how to cope with the issue of an iteration no longer being consistent with mutable data. We validate o...
متن کاملSignal Design at lsolated lntersecaions Using Expert Systems Technology
The procedural steps for developing an expert system for designing signals at isolated intersections are described and the most important development issues for each step are discussed. The steps include problem analysis and definition, preliminary prototype specification, knowledge acquisition strategy development, prototype development plan, knowledge extraction, knowledge representation, too...
متن کاملSafe Iterator Framework for the C++ Standard Template Library
The C++ Standard Template Library is the flagship example for libraries based on the generic programming paradigm. The usage of this library is intended to minimize classical C/C++ errors, but does not warrant bug-free programs. Furthermore, many new kinds of errors may arise from the inaccurate use of the generic programming paradigm, like dereferencing invalid iterators or misunderstanding re...
متن کاملA novel vedic divider based crypto-hardware for nanocomputing paradigm: An extended perspective
Restoring and non-restoring divider has become widely applicability in the era of digital computing application due to its computation speed. In this paper, we have proposed the design of divider of different architecture for the computation of Vedic sutra based. The design of divider in the Vedic mode results in high computation throughput due to its replica architecture, where latency is mini...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- IEEE Trans. Software Eng.
دوره 20 شماره
صفحات -
تاریخ انتشار 1994